function fibonacci(num) {
  return num <= 2 ? 1 : fibonacci(num - 1) + fibonacci(num - 2);
}

// 接受主线程消息
self.onmessage = function (e) {
  const num = e.data;
  const result = fibonacci(num);
  // 将计算结果传递给主线程
  self.postMessage(result)
};
